package com.example.Project.Class;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;

import java.io.IOException;
import java.time.LocalDate;

public class CustomLocalDateDeserializer extends JsonDeserializer<LocalDate> {
    @Override
    public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
        String dateValue = p.readValueAs(String.class);
        if ("null".equals(dateValue)) {
            return null;
        } else {
            // 进行正常的日期解析
            return LocalDate.parse(dateValue);
        }
    }
}
